package jvm.string;

import java.util.Scanner;

public class LookStringIntern {
    private final static int CIRCLE_COUNT=1000*10000;
    private final static String[]strRefer=new String[CIRCLE_COUNT];
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        long start=System.currentTimeMillis();
        for(int i=0;i<CIRCLE_COUNT;i++){
//            strRefer[i]=String.valueOf((i%10));//gc时不会被回收
            strRefer[i]=String.valueOf((i%10)).intern();//gc时大量字符串会被gc
        }
        long end=System.currentTimeMillis();
        System.out.println("take:"+(end-start));
        scanner.next();
        System.gc();
        scanner.next();
    }
}
